import request from "../utils/request.js";
//登录
export const userLogin = ({ username, password }) => {
  return request.post("login", { username: username, password: password });
};

//报名
export const userJoin = (joinObj) => {
  return request.post("classes/VueJoin", joinObj);
};

//查询当前用户有没有报名当前岗位
export const joinCheck = (userId, jobId) => {
  return request.get("classes/VueJoin", {
    params: {
      where: {
        userId,
        jobId,
      },
    },
  });
};

//我的岗位
export const joinGet = (userId, status) => {
  let where = { userId };
  if (status) {
    where.joinStatus = status; //只有status不为0的时候，需要携带
  }
  let query = JSON.stringify(where);
  //   get请求携带参数方法1：
  return request.get(`classes/VueJoin?where=${query}`);
  //   get请求携带参数方法2：
  //   return request.get(`classes/VueJoin`, {
  //     params: { where },
  //   });
};
